@(verkefniId: Int, vaegi: Double, questions: List[models.domain.Question], verkefniSpurningaForm: Form[models.data.Verkefnaspurningar],
questionForm: Form[models.data.Spurningar],courses: List[models.general.vKennariHoparOnn], annir: List[models.data.Annir],nafnVerkefnis: String)
@teacherMain(title = "Nýtt Verkefni") {

    <link rel="stylesheet" href="/public/stylesheets/AssignmentQuestions.css">
    <script src="/public/javascripts/assignmentQuestions.js"></script>
    <script src="/public/javascripts/DataTables/datatables.js"></script>
    <script src="/public/javascripts/DataTables/datatables-bootstrap.js"></script>

    <div class="container">
        <div class="row">
            <div class="span12">

                <ul class="breadcrumb">
                    <li>Búa til verkefni<span class="divider">/</span></li>
                    <li class="active">Velja spurningar<span class="divider">/</span></li>
                    <li >Leggja verkefni fyrir hóp<span class="divider">/</span></li>
                    <li>Lokið<li>
                </ul>

                <div>
                    <div id="legend" class="">
                        <legend class="" style="font-size: 20pt">Valdar spurningar í <span class="boldLine">@nafnVerkefnis</span></legend>
                    </div>

                    @helper.form(action = routes.TeacherController.putQuestionToAssignment(), 'class -> "form-horizontal") {
                        <table class="table table-hover" id="tbl1">
                            <thead>
                                <tr>
                                    <th>Fjarlægja spurningu</th>
                                    <th><strong>Spurning</strong></th>
                                    <th><strong>Vægi spurningar (%)</strong></th>
                                    <th>Tegund</th>
                                    <th>Bók</th>
                                    <th>Áfangi</th>
                                    <th>Leitarskilyrði</th>
                                </tr>
                            </thead>
                            <input type="hidden" name="verkefni_id" value="@{verkefniId}">
                            <tbody id="tbl1body">
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td></td>
                                    <td><b>Setja sama vægi á allar spurningar:</b></td>
                                    <td><input type="number"  min="0" max="100"  class="inputVaegi" value="0" id="tblfoot" step="0.5" onchange="updateAll()"></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            </tfoot>
                        </table>
                        <div class="control-group">
                            <div class="form-actions">
                                <a href="@routes.TeacherController.teacherDashboard()"> <input type="button" class="btn pull-right" value="Hætta við" /> </a>
                                <button style="margin-right:5px" type="submit" class="btn btn-primary pull-right" value="submit">Samþykkja valdar spurningar</button>
                            </div>
                        </div>
                    }

                    <script>
                            function show2 (val)
                            { $("#blob"+val).popover({html:true});
                            }
                    </script>

                </div>
                <div>
                    <div id="legendAssignment" class="">
                        <legend class="" style="font-size: 20pt">Allar spurningar</legend>
                    </div>

                    <p id="createNewQuestion"  class="float-left"><a href="@routes.TeacherController.createQuestion(verkefniId)" style="margin-top:10px;" role="button" class="btn btn-primary" data-toggle="modal"> <i class="icon-white icon-edit"></i> Búa til nýja spurningu</a> </p>

                    <table class="table table-hover" id="tbl2">
                        <thead>
                            <tr>
                                <th style="width:110px">Velja spurningu</th>
                                <th><strong>Spurning</strong></th>
                                <th><strong>Vægi</strong></th>
                                <th>Tegund</th>
                                <th>Bók</th>
                                <th>Áfangi</th>
                                <th style="width:95px">Leitarskilyrði</th>
                            </tr>
                        </thead>
                        <tbody id="tbl2body">
                            @for(question <- questions){
                                <tr id="row@question.spurningar_id">
                                <td><input type="checkbox" name="spurningar_id" id="@{question.spurningar_id}" onclick="enable(@question.spurningar_id)" value="@{question.spurningar_id}">
                                <a style="float:right" href="javascript:show2('@question.spurningar_id');" id='blob@question.spurningar_id' data-placement="right" class="btn btn-mini" rel="popover" data-content="<strong>Texti spurningar:</strong> @question.texti<br/><strong>Tegund spurningar:</strong> @question.tegund<br/><strong>Áfangi:</strong> @question.namsgrein_afanganr<br/><strong>Heiti bókar:</strong> @question.bok_heiti<br/><strong>Þyngdarstig spurningar:</strong> @question.tyngdarstig_heiti<br/><strong>Búin til:</strong> @question.dagurbuidtil" data-original-title="<strong>Frekari upplýsingar</strong>"><i class="icon-search"></i></a></td>
                                <td>@{question.texti}</td>

                                <td><input type="number"  min="0" max="100" value="0" class="inputVaegi" name="vaegi"  disabled="true" id="s@{question.spurningar_id}"></td>

                                    @if(question.tegund=="texti"){
                                        <td>Textaspurning</td>
                                    }
                                    @if(question.tegund=="krossar"){
                                        <td>Krossaspurning</td>
                                    }
                                    @if(question.tegund=="eydufylling"){
                                        <td>Eyðufylling</td>
                                    }
                                    @if(question.tegund=="fjolval"){
                                        <td>Fjölvalsspurning</td>
                                    }
                                    @if(question.tegund=="mynd"){
                                        <td>Myndaspurning</td>
                                    }
                                    @if(question.tegund=="vidhengi"){
                                        <td>Viðhengi</td>
                                    }
                                <td>@question.bok_heiti</td>
                                <td>@(question.namsgrein_afanganr)</td>
                                <td><ul style="margin-left:0px" class="tags">
                                    @for(tag <- question.tags){
                                        <li>
                                            @tag.leitarskilyrdi
                                        </li>
                                    }

                                </ul></td>
                                </tr>}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div> <!--end of container-->
}
